function f = function_symbolic_computing_1d(u, derivative)

if iscell(u)
    switch derivative
        case "dx"
            f = cellfun(@(f) matlabFunction(diff(f(sym('xi')), sym('xi')), 'Vars', sym('xi')), u, 'UniformOutput', false);

        case "dxdx"
            f = cellfun(@(f) matlabFunction(diff(f(sym('xi')), sym('xi'), 2), 'Vars', sym('xi')), u, 'UniformOutput', false);

        otherwise
            error('Invalid equation type');
    end
else
    syms x
    sym_u = u(x);

    switch derivative
        case "dx"
            sym_f = diff(sym_u, x);

        case "dxdx"
            sym_f = diff(sym_u, x, 2);

        otherwise
            error('Invalid derivative type');
    end

    f = matlabFunction(sym_f, 'Vars', x);
end

end